import request from '@/utils/http';

/**
 * 获取角色列表
 * @param params
 * @returns
 */
export const getRoleList = (params: any) => {
  return request.get('/role/list', { params });
};

/**
 * 获取角色详情
 * @param roleId
 * @returns
 */
export const getRole = (roleId: any) => {
  return request.get(`/role/${roleId}`);
};

export const addRole = (params: any) => {
  return request.post(`/role`, params);
};

/**
 * 修改角色
 * @param params
 * @returns
 */
export const updateRole = (params: any) => {
  return request.put(`/role`, params);
};

/**
 * 修改角色状态
 * @param params
 * @returns
 */
export const changeRoleStatus = (params: any) => {
  return request.put(`/role/changeStatus`, params);
};

export const deleteRole = (roleIds: any) => {
  return request.delete(`/role/${roleIds}`);
};

/**
 * 查询已分配用户角色列表
 * @param params
 * @returns
 */
export const getAllocatedRoleUser = (params: any) =>
  request.get('/role/authUser/allocatedList', { params });

/**
 * 查询未分配用户角色列表
 * @param params
 * @returns
 */
export const getUnallocatedRoleUser = (params: any) =>
  request.get('/role/authUser/unallocatedList', { params });

/**
 * 取消用户授权角色
 * @param params
 * @returns
 */
export const cancelAuthUser = (params: any) => {
  return request.put('/role/authUser/cancel', params);
};

/**
 * 批量取消用户授权角色
 * @param params
 * @returns
 */
export const cancelAuthUserAll = (params: any) => {
  return request.put('/role/authUser/cancelAll', params);
};

/**
 * 批量选择用户授权角色
 * @param params
 * @returns
 */
export const selectAuthUser = (params: any) => {
  return request.put('/role/authUser/selectAll', params);
};
